import request from '@/utils/request'
import { param } from 'jquery'

// 查询生成表数据
export function listTable(query) {
  return request({
    url: '/tool/gen/list',
    method: 'get',
    params: query
  })
}
// 查询db数据库列表
export function listDbTable(query) {
  return request({
    url: '/tool/gen/db/list',
    method: 'get',
    params: query
  })
}

// 查询表详细信息
export function getGenTable(tableId) {
  return request({
    url: '/tool/gen/' + tableId,
    method: 'get'
  })
}

// 修改代码生成信息
export function updateGenTable(data) {
  return request({
    url: '/tool/gen',
    method: 'put',
    data: data
  })
}

// 导入表
export function importTable(data) {
  return request({
    url: '/tool/gen/importTable',
    method: 'post',
    params: data
  })
}

// 预览生成代码
export function previewTable(tableId) {
  return request({
    url: '/tool/gen/preview/' + tableId,
    method: 'get'
  })
}

// 删除表数据
export function delTable(tableId) {
  return request({
    url: '/tool/gen/' + tableId,
    method: 'delete'
  })
}

// 生成代码（自定义路径）
export function genCode(tableName) {
  return request({
    url: '/tool/gen/genCode/' + tableName,
    method: 'get'
  })
}

// 同步数据库
export function synchDb(tableName) {
  return request({
    url: '/tool/gen/synchDb/' + tableName,
    method: 'get'
  })
}


//自动翻新

//翻新渠道列表
export function renovateList() {
  return request({
    url: '/renovate/job/sale/list',
    method: 'get'
  })
}

//新增翻新任务
export function addJob(data) {
  return request({
    url: '/renovate/job',
    method: 'post',
    data:data
  })
}

//编辑详情
export function editJob(id) {
  return request({
    url: `/renovate/job/${id}`,
    method: 'get',
  
  })
}

//修改
export function editJobs(data) {
  return request({
    url: `/renovate/job`,
    method: 'put',
    data:data
  })
}

//删除
export function delJob(id) {
  return request({
    url: `/renovate/job/${id}`,
    method: 'DELETE',
  
  })
}




export function jobList(data) {
  return request({
    url: '/renovate/job/list',
    method: 'get',
    params:data
  })
}


//翻新记录

export function getRenovateRecord(data) {
  return request({
    url: '/renovate/job/rec/list',
    method: 'get',
    params:data
  })
}

//翻新列表状态
export function changeStatus(data) {
  return request({
    url: '/renovate/job/changeStatus',
    method: 'put',
     data: data
  })
}


//自动降价 新增
export function addReducePrice(data) {
  return request({
    url: '/reducePrice',
    method: 'post',
     data: data
  })
}

//自动降价 修改
export function putReducePrice(data) {
  return request({
    url: '/reducePrice',
    method: 'put',
     data: data
  })
}



//自动降价 删除
export function delReducePrice(id) {
  return request({
    url: `/reducePrice/${id}`,
    method: 'DELETE',
  })
}

// 自动降价列表
export function reducePriceList(data) {
  return request({
    url: '/reducePrice/list',
    method: 'get',
     params: data
  })
}

//查询自动降价记录列表
export function reducePriceRecList(data) {
  return request({
    url: '/reducePriceRec/list',
    method: 'get',
     params: data
  })
}